package im.elephas.androfan.common.widget;

import im.elephas.androfan.R;
import im.elephas.androfan.activity.AndroFanActivity;
import im.elephas.androfan.common.widget.RefreshWidget.RefreshOpration;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

public class SendWidget extends GeneralWidget implements OnClickListener {

	public interface SendOpration {
		public void doSend(String msg);
	}

	public SendOpration mSendOpration;
	private View quickMessageView;
	private EditText sendEditText;
	private ImageButton sendButton;
	
	public SendWidget(ViewGroup parentView,
			AndroFanActivity androFanActivity, SendOpration send) {
		super(parentView, androFanActivity);
		
		this.mSendOpration = send;
		quickMessageView = getActivity().getLayoutInflater().inflate(
				R.layout.quicknewmessage, null);
		setWidgetView(quickMessageView);
		sendButton = (ImageButton)quickMessageView.findViewById(R.id.sendImageButton);
		sendEditText = (EditText)quickMessageView.findViewById(R.id.quickSendMessageEditText);
		sendButton.setImageResource(android.R.drawable.ic_menu_send);
		sendButton.setOnClickListener(this);
	}

	@Override
	public void onClick(View arg0) {
		mSendOpration.doSend(sendEditText.getText().toString());
		sendButton.setEnabled(false);
		sendEditText.setEnabled(false);
	}

}
